<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<script type="text/javascript">
    let person = {
        name: '张三',
        age: 18
    }

    const p = new Proxy(person, {
        get(target, propName) {
            console.log(`有人读取了p身上的${propName}属性,我要去更新界面了`, target, propName)
            return target[propName]
        },
        set(target, propName, value) {
            console.log(`有人设置了p身上的${propName}属性,我要去更新界面了`, target, propName, value)
            return target[propName] = value
        },
        deleteProperty(target, propName) {
            console.log(`有人删除了p身上的${propName}属性,我要去更新界面了`, target, propName)
            return delete target[propName]
        }
    })
</script>
</body>
</html>